import time
f1 = open("m1_sorted.txt")
f2 = open("m2_reverse.txt")
f3 = open("m3_shuffle.txt")
a1 = [int(x) for x in f1]
a2 = [int(x) for x in f2]
a3 = [int(x) for x in f3]

def sort(n):
    for i in range(len(n)):
        for j in range(len(n) - 1 - i):
            if n[j] > n[j + 1]:
                n[j], n[j+1] = n[j+1], n[j]

start1 = time.time()
sort(a1)
finish1 = time.time()
t1 = round((finish1 - start1)*1000)
print("Время сортировки m1_sorted.txt в миллисекундах = ", t1)

start2 = time.time()
sort(a2)
finish2 = time.time()
t2 = round((finish2 - start2)*1000)
print("Время сортировки m2_reverse.txt в миллисекундах = ", t2)

start3 = time.time()
sort(a3)
finish3 = time.time()
t3 = round((finish3 - start3)*1000)
print("Время сортировки m3_shuffle.txt в миллисекундах = ", t3)